// 封装截留函数
// 返回一个具备节流效果的函数
export const throttle = function (fn, t) {
  let timerId = null
  function throttleDoSomething () {
    if (timerId) {
      return
    }
    console.log('throttleDoSomething', this)
    timerId = setTimeout(() => {
      fn.apply(this)
      timerId = null
    }, t)
  }
  return throttleDoSomething
}
